local joyex__jueqing = fk.CreateSkill {

  name = "joyex__jueqing",

  tags = {  },

}



joyex__jueqing:addEffect(fk.DamageCaused, {
  name = "joyex__jueqing",
  anim_type = "offensive",
  events = {fk.DamageCaused},
  can_trigger = function(self, event, target, player, data)
    return target == player and player:hasSkill(joyex__jueqing.name)
  end,
  on_cost = function(self, event, target, player, data)
    return player.room:askForSkillInvoke(player, joyex__jueqing.name, nil, "#joyex__jueqing-invoke2::"..data.to.id)
  end,
  on_use = function(self, event, target, player, data)
    player.room:loseHp(data.to, data.damage, joyex__jueqing.name)
    return true
  end,
})

joyex__jueqing:addEffect(fk.PreDamage, {
  name = "#joyex__jueqing_trigger",
  anim_type = "offensive",
  events = {fk.PreDamage},
  can_trigger = function(self, event, target, player, data)
    return target == player and player:hasSkill(joyex__jueqing.name)  and not data.chain
  end,
  on_cost = function(self, event, target, player, data)
    return player.room:askForSkillInvoke(player, joyex__jueqing.name, nil, "#joyex__jueqing-invoke1::"..data.to.id)
  end,
  on_use = function(self, event, target, player, data)
     player.room:loseHp(player, 1, joyex__jueqing.name)
    data.damage = data.damage +1
  end,
})

return joyex__jueqing